/*
Copyright 2005-2014 CP Fricano - All Rights Reserved

This software and source code is licensed under the Apache
License, Version 2.0. You may not use this software or source
code except in compliance with the License.  You may obtain a
copy of the License at: http://www.apache.org/licenses/LICENSE-2.0.
Use and distributed under this License is on an "as is" basis,
without expressed or implied warranties or conditions of any kind.
See the License for the specific language governing permissions and
limitations.
 */

package com.fricano.java42.instructional.example.jni;

public class J42JNI_01 {

    final public static int FUNCTION_01 = 0x01;
    final public static int FUNCTION_02 = 0x02;
    final public static int FUNCTION_04 = 0x04;
    final public static int FUNCTION_08 = 0x08;
    final public static int FUNCTION_10 = 0x10;
    final public static int FUNCTION_20 = 0x20;
    final public static int FUNCTION_40 = 0x40;
    final public static int FUNCTION_80 = 0x80;

    final private double    varD        = 23.45d;
    final private float     varF        = 23.45f;
    final private int       varI        = 2345;
    final private byte      varB        = 127;

    final private double[]  dArray;
    final private float[]   fArray;
    final private int[]     iArray;
    final private byte[]    bArray;

    public J42JNI_01() {
        dArray = new double[4];
        fArray = new float[4];
        iArray = new int[4];
        bArray = new byte[256];
    }

    @Override
    public String toString() {
        String s = "";
        s += "\n";
        for (final double x : dArray) {
            s += x + " - ";
        }
        s += "\n";
        for (final float x : fArray) {
            s += x + " - ";
        }
        s += "\n";
        for (final int x : iArray) {
            s += x + " - ";
        }
        s += "\n";
        for (final byte x : bArray) {
            s += x + " - ";
        }
        s += "\n";
        return s;
    }

    public native J42JNI_01 nativeService(int FUNCTION);

    public static native J42JNI_01 nativeServiceStatic(int FUNCTION);

}
